package com.umanji.postgis.service;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.umanji.generic.service.postgisGenericService;
import com.umanji.postgis.domain.Tbbi001;

@Service("postgisService")
@Transactional(propagation=Propagation.SUPPORTS, readOnly=true)
public class PostgisServiceImpl extends postgisGenericService<Tbbi001, String> implements PostgisService {

	private final Log log = LogFactory.getLog ( PostgisServiceImpl.class );

    public Tbbi001 findByBuildingNo(String no) {
    	log.debug("building no ::::::::::::::::::::::::::::::: " + no);
    	// return (Tbbi001) em.createQuery("from " + Tbbi001.class.getSimpleName()).getSingleResult();
    	return (Tbbi001) em.createQuery("Select t from " + Tbbi001.class.getSimpleName() + " t where t.buildingNo = :no").setParameter("no", no).getSingleResult();
    }
}
